using System.Collections.Generic;

namespace Infinity.API.Core
{
	public class SequenceCodeAction : CodeAction
	{
		protected readonly List<CodeAction> m_CodeActions = new List<CodeAction>();

		public List<CodeAction> Items { get { return m_CodeActions; } }

		public SequenceCodeAction() { }

		public SequenceCodeAction(params CodeAction[] codeActions)
			: this()
		{
			m_CodeActions.AddRange(codeActions);
		}

		/// <summary>
		/// Run action
		/// </summary>
		public override void Run()
		{
			OnExecuting(this);
			foreach (var action in m_CodeActions)
				action.Run();
			OnExecuted(this);
		}
	}
}